using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Husb.DataUtil;
using Husb.Security;

namespace CentralOffice.Admin.DataAccess
{
    public class RoleAdapter
    {
        private const string GetUsersForRoleStoredProc = "Admin.Roles_GetUsersForRole";

        public static DataTable GetUsersForRole()
        {
            List<DatabaseParameter> p = new List<DatabaseParameter>();

            GenericRoleProvider roleProvider = System.Web.Security.Roles.Provider as GenericRoleProvider;
            p.Add(new DatabaseParameter("ApplicationName", "String", roleProvider.ApplicationName));
            //p.Add(new DatabaseParameter("RoleName", "String", rolename));
            DataSet ds = Husb.DataUtil.DataAccessUtil.GetDataSet(GetUsersForRoleStoredProc, p, true, false, null);

            return ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 ? ds.Tables[0] : null;
        }
    }
}
